---
layout: "default"
title: "EmptyGenerator"
description: "Swift documentation for 'EmptyGenerator': A generator that never produces an element."
keywords: "EmptyGenerator,struct,swift,documentation,generate,next,Generator,Element"
root: "/v1.2"
---

<div class="intro-declaration"><code class="language-swift">struct EmptyGenerator&lt;T&gt;</code></div>

<div class="discussion comment">
    <p>A generator that never produces an element.</p>

<p>See also: <code>EmptyCollection&lt;T&gt;</code>.</p>
</div>

<table class="standard">
<tr>
<th id="inheritance">Inheritance</th>
<td>
<code class="inherits">GeneratorType, SequenceType, _SequenceType, _Sequence_Type</code>
<span class="viz"><a href="hierarchy/">View Protocol Hierarchy &rarr;</a></span>
</td>
</tr>

<tr>
<th id="aliases">Associated Types</th>
<td>
<span id="aliasesmark"></span>
<div class="declaration">
<code class="language-swift">Generator = EmptyGenerator&lt;T&gt;</code>
<div class="comment">
    <p><em>Type alias inferred.</em></p>
</div>
</div>
<div class="declaration">
<code class="language-swift">Element = Generator.Element</code>
<div class="comment">
    <p><em>Type alias inferred.</em></p>
</div>
</div>
</td>
</tr>


<tr>
<th>Import</th>
<td><code class="language-swift">import Swift</code></td>
</tr>

</table>


<h3>Initializers</h3>
<div class="declaration" id="init">
<a class="toggle-link" data-toggle="collapse" href="#comment-init">init()</a><div class="comment collapse" id="comment-init"><div class="p">
    <p>Construct an instance</p>

    <h4>Declaration</h4>    
    <code class="language-swift">init()</code>

    </div></div>
</div>





<h3>Instance Methods</h3>
<div class="declaration" id="func-generate">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-generate">func generate()</a>
        
<div class="comment collapse" id="comment-func-generate"><div class="p">
    <p><code>EmptyGenerator</code> is also a <code>SequenceType</code>, so it <code>generate</code>&#39;s
a copy of itself</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func generate() -&gt; EmptyGenerator&lt;T&gt;</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-next">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-next">mutating func next()</a>
        
<div class="comment collapse" id="comment-func-next"><div class="p">
    <p>Return <code>nil</code>, indicating that there are no more elements.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">mutating func next() -&gt; T?</code>
    
    
</div></div>
</div>


